i386: Simplify failsafe callback handling.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 21 Jun 2007 20:36:26 +0000 (21:36 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 21 Jun 2007 20:36:26 +0000 (21:36 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/x86_32/entry.S
xen/include/asm-x86/x86_32/asm_defns.h

index 06eda7bff144157538ff8a48f49509c31cfca4cc..8ca596e15fb25c1dc450bfc1ad87cbf28d1b1a15 100644 (file)
@@ -99,17 +99,9 @@ restore_all_guest:
 .Lrestore_iret_guest:
 .Lft5:  iret
 .section .fixup,"ax"
-.Lfx1:  subl  $28,%esp
-        pushl 28(%esp)                 # error_code/entry_vector
-        movl  %eax,UREGS_eax+4(%esp)
-        movl  %ebp,UREGS_ebp+4(%esp)
-        movl  %edi,UREGS_edi+4(%esp)
-        movl  %esi,UREGS_esi+4(%esp)
-        movl  %edx,UREGS_edx+4(%esp)
-        movl  %ecx,UREGS_ecx+4(%esp)
-        movl  %ebx,UREGS_ebx+4(%esp)
-        sti
-        popl  %esi
+.Lfx1:  sti
+        SAVE_ALL_GPRS
+        mov   UREGS_error_code(%esp),%esi
         pushfl                         # EFLAGS
         movl  $__HYPERVISOR_CS,%eax
         pushl %eax                     # CS
index c12039e910277f423aa3752e6646b1397f966ede..6bf7e2c619753938a10b773159dae06389bfe7d8 100644 (file)
 #define ASSERT_INTERRUPTS_ENABLED  ASSERT_INTERRUPT_STATUS(nz)
 #define ASSERT_INTERRUPTS_DISABLED ASSERT_INTERRUPT_STATUS(z)
 
+#define SAVE_ALL_GPRS                                   \
+        cld;                                            \
+        pushl %eax;                                     \
+        pushl %ebp;                                     \
+        SETUP_EXCEPTION_FRAME_POINTER;                  \
+        pushl %edi;                                     \
+        pushl %esi;                                     \
+        pushl %edx;                                     \
+        pushl %ecx;                                     \
+        pushl %ebx
+
 /*
  * Saves all register state into an exception/interrupt stack frame.
  * Returns to the caller at <xen_lbl> if the interrupted context is within
  * the caller is reponsible for validity of %ds/%es.
  */
 #define SAVE_ALL(xen_lbl, vm86_lbl)                     \
-        cld;                                            \
-        pushl %eax;                                     \
-        pushl %ebp;                                     \
-        SETUP_EXCEPTION_FRAME_POINTER;                  \
-        pushl %edi;                                     \
-        pushl %esi;                                     \
-        pushl %edx;                                     \
-        pushl %ecx;                                     \
-        pushl %ebx;                                     \
+        SAVE_ALL_GPRS;                                  \
         testl $(X86_EFLAGS_VM),UREGS_eflags(%esp);      \
         mov   %ds,%edi;                                 \
         mov   %es,%esi;                                 \